Operations endpoints: logspec handler#930
Open
gengur wants to merge 4 commits into
Open
Conversation
9cb3525 to
aaa9cb2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a /logspec operations endpoint (Fabric-style) to allow updating runtime logging spec, and wires it into node startup logs plus fault-tolerance tests that validate changing log level during execution (issue #45 “Operations Service”).
Changes:
- Register
/logspechandler in the operations system usingfabric-lib-go/common/flogging/httpadmin. - Log the logspec service URL during node startup (router/consenter/batcher/assembler).
- Add test utilities + fault-tolerance tests that GET/PUT
/logspecand assert debug logging appears after update.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| vendor/modules.txt | Vendors the httpadmin package path. |
| vendor/github.com/hyperledger/fabric-lib-go/common/flogging/httpadmin/spec.go | Adds the vendored logspec HTTP handler implementation. |
| common/operations/system.go | Registers /logspec handler and exposes a LogSpecServiceURL helper. |
| node/router/router.go | Logs logspec service URL on router init. |
| node/consensus/consensus.go | Logs logspec service URL on consenter start. |
| node/batcher/batcher.go | Logs logspec service URL on batcher run. |
| node/assembler/assembler.go | Logs logspec service URL on assembler creation. |
| testutil/network_utils.go | Adds helpers to capture /logspec URL and GET/PUT its JSON payload. |
| test/faulttolerance/router_test.go | Adds logspec runtime-change test for router. |
| test/faulttolerance/consensus_test.go | Adds logspec runtime-change test for consenter. |
| test/faulttolerance/batcher_test.go | Adds logspec runtime-change test for batcher. |
| test/faulttolerance/assembler_test.go | Adds logspec runtime-change test for assembler. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+169
to
+182
| // parameters: | ||
| // - name: payload | ||
| // in: formData | ||
| // type: string | ||
| // description: The payload must consist of a single attribute named spec. | ||
| // required: true | ||
| // responses: | ||
| // '204': | ||
| // description: No content. | ||
| // '400': | ||
| // description: Bad request. | ||
| // consumes: | ||
| // - multipart/form-data | ||
| s.RegisterHandler("/logspec", httpadmin.NewSpecHandler(), s.options.TLS.Enabled) |
Comment on lines
+372
to
+376
| rl, err := armageddon.NewRateLimiter(rate, fillInterval, capacity) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "failed to start a rate limiter") | ||
| os.Exit(3) | ||
| } |
Comment on lines
+382
to
+386
| status := rl.GetToken() | ||
| if !status { | ||
| fmt.Fprintf(os.Stderr, "failed to send tx %d", i+1) | ||
| os.Exit(3) | ||
| } |
Comment on lines
+235
to
+239
| rl, err := armageddon.NewRateLimiter(rate, fillInterval, capacity) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "failed to start a rate limiter") | ||
| os.Exit(3) | ||
| } |
Comment on lines
+245
to
+249
| status := rl.GetToken() | ||
| if !status { | ||
| fmt.Fprintf(os.Stderr, "failed to send tx %d", i+1) | ||
| os.Exit(3) | ||
| } |
Comment on lines
+568
to
+572
| status := rl.GetToken() | ||
| if !status { | ||
| fmt.Fprintf(os.Stderr, "failed to send tx %d", i+1) | ||
| os.Exit(3) | ||
| } |
Comment on lines
+339
to
+343
| rl, err := armageddon.NewRateLimiter(rate, fillInterval, capacity) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "failed to start a rate limiter") | ||
| os.Exit(3) | ||
| } |
Comment on lines
+349
to
+353
| status := rl.GetToken() | ||
| if !status { | ||
| fmt.Fprintf(os.Stderr, "failed to send tx %d", i+1) | ||
| os.Exit(3) | ||
| } |
Comment on lines
+153
to
+155
| req.Header.Set("Content-Type", "application/json") | ||
| return http.DefaultClient.Do(req) | ||
| } |
5f80425 to
cfee6f0
Compare
cfee6f0 to
d8a6a4b
Compare
b1e003f to
01ba700
Compare
01ba700 to
af1541a
Compare
Signed-off-by: Genady Gurevich <genadyg@il.ibm.com>
af1541a to
97be911
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue: #45